{% extends "base_generic.html" %}
{% load i18n %}

{% block content %}
    <h1>{% translate "Renew:" %} {{ book_instance.book.title }}</h1>
    <p>{% translate "Borrower:" %} {{ book_instance.borrower }}</p>
    <p{% if book_instance.is_overdue %} class="text-danger"{% endif %}>{% translate "Due date:" %} {{ book_instance.due_back }}</p>
    
    <form action="" method="post" novalidate>
        {% csrf_token %}
        
        {% for field in form %}
          <div class="mb-3">
            <label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
            {{ field }}
            {% if field.help_text %}
              <small class="form-text text-muted">{{ field.help_text|safe }}</small>
            {% endif %}
            {% for error in field.errors %}
              <div class="invalid-feedback d-block">
                {{ error }}
              </div>
            {% endfor %}
          </div>
        {% endfor %}
        
        <button type="submit" class="btn btn-primary">{% translate "Submit Renewal" %}</button>
        <a href="{% url 'all-borrowed' %}" class="btn btn-secondary">{% translate "Cancel" %}</a>
    </form>
{% endblock %}
